const resize = {
  mounted(el, binding) {
    const resizeObserver = new ResizeObserver(entries => {
      for (let entry of entries) {
        binding.value(entry);
      }
    });
    resizeObserver.observe(el);
    el._resizeObserver = resizeObserver;
  },
  unmounted(el) {
    el._resizeObserver.disconnect();
  }
}

export default resize;